package com.example.clickgame;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class TransparentActivity extends Activity implements OnClickListener {
	private Button restart, exit;
	private Intent data;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_transparent);
		restart = (Button) findViewById(R.id.restart_game);
		exit = (Button) findViewById(R.id.exit_game);
		restart.setOnClickListener(this);
		exit.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.exit_game:
			data = getIntent();
			data.setData(Uri.parse("exit"));
			break;
		case R.id.restart_game:
			data = getIntent();
			data.setData(Uri.parse("restart"));
			break;
		}
		setResult(RESULT_OK, data);
		finish();
	}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	// TODO Auto-generated method stub
	if(event.equals(KeyEvent.KEYCODE_BACK)){
		Toast.makeText(TransparentActivity.this,"key back is down!",0).show();
		return false;
	}
	return super.onKeyDown(keyCode, event);
}
}
